import * as mars3d from "mars3d"
import { toRaw } from 'vue';


export const useWallEntity = (_graphicLayer) => {
  let graphicLayer: any = null

  const Cesium = mars3d.Cesium
  
  const initWallEntity = () => {
    graphicLayer = toRaw(_graphicLayer.value); 

    const graphic = new mars3d.graphic.WallEntity({
      positions: [[121.417552, 30.992721, 0], [121.409757, 30.988906, 0], [121.412839, 30.98566, 0]],
      style: {
        closure: true,
        diffHeight: 40,
        materialType: mars3d.MaterialType.WallScroll,
        materialOptions: {
          image: "https://data.mars3d.cn/img/textures/fence.png",
          color: Cesium.Color.CHARTREUSE,
          count: 3,
          speed: 100,
          bloom: true
        }
      },
      attr: { remark: "示例10" }
    })
    graphicLayer.addGraphic(graphic)
  }

  return {
    initWallEntity
  }
}